// 步骤二：引入转换immutable对象模块
import { fromJS } from "immutable";

// 导入数据修改处理程序
import mutation from "../mutation/countMutation";

/**
 * 初始化数据
 */
const initCount = fromJS({
	count: 0,
});

const reducer = (state = initCount, { type, data }) => {
	try {
		return mutation[type](state, data);
	} catch (error) {
		return state;
	}
};
export default reducer;
